import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from '@/page/login.vue';
import Home from '@/page/home.vue';
import Practice from '@/page/practice.vue';
import QuestionType from '@/page/question_type.vue';
import UserCenter from '@/page/user_center.vue';
import Exercise from '@/page/exercise.vue';
import History from '@/page/history.vue';
import AnswerSub from '@/page/answer_sub.vue';
import layout from '@/components/layout.vue';
import SuceesView from "@/page/sucees_view.vue"
import ErrorList from '@/page/error_list.vue';
import UserHistory from '@/page/user_history.vue';
import UserAnswerSub from '@/page/user_answer_sub.vue'
import SuccessUserView from '@/page/sucees_user_view.vue'
// 告诉Vue使用Vue Router
Vue.use(VueRouter);

// 定义路由配置
const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login,
  },

  {
    path: '/',
    name: 'layout',
    component: layout,
    children:[
      {
        path: '/',
        name: 'Home',
        component: Home,
      },
  
      {
        path: '/practice',
        name: 'Practice',
        component: Practice,
      },
      {
        path: '/question_type',
        name: 'QuestionType',
        component: QuestionType,
      },
      {
        path: '/user_center',
        name: 'UserCenter',
        component: UserCenter,
      },
      {
        path: '/exercise',
        name: 'Exercise',
        component: Exercise,
      },
      {
        path: '/history',
        name: 'History',
        component: History,
      },
      {
        path: '/user_history',
        name: 'UserHistory',
        component: UserHistory,
      },
      {
        path: '/answer_sub',
        name: 'AnswerSub',
        component: AnswerSub,
      },
      {
        path: '/answer_user',
        name: 'answer_user',
        component: UserAnswerSub,
      },
      {
        path: '/suceesView',
        name: 'suceesView',
        component: SuceesView,
      },
      {
        path: '/suceesUserView',
        name: 'suceesUserView',
        component: SuccessUserView,
      },
      {
        path: '/error_list',
        name: 'ErrorList',
        component: ErrorList,
      }
    ]
  },
  
];

// 创建路由实例
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;